package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.ProductStockEntity;
import com.xbongbong.saas.domain.entity.ProductStockUpdateEntity;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/6/7 14:02
 * @since v1.0
 */
public interface ProductStockDao {

    Integer insert(ProductStockEntity productStockEntity);

//    Integer update(ProductStockEntity productStockEntity);

    List<ProductStockEntity> findEntitys(@Param("param") Map<String,Object> param);

    void insertBatch(List<ProductStockEntity> insertList);

    void updateBatch(@Param("list") List<ProductStockEntity> updateList,@Param("corpid") String corpid);

    void updateBatchWarehouse(@Param("list") List<ProductStockEntity> updateList,@Param("corpid") String corpid);

    void deleteByIdIn(@Param("corpid") String corpid, @Param("idIn") List<Long> idIn);

    List<ProductStockEntity> findEntitysForUpdate(@Param("param") Map<String, Object> map);

    void updateStockDB(@Param("batchKeyList") Set<String> batchKeyList, @Param("list") Collection<ProductStockUpdateEntity> values, @Param("corpid") String corpid);

    List<String> getExistBatchKeyList(@Param("corpid") String corpid, @Param("batchKeyList") Set<String> batchKeyList);

    List<ProductStockEntity> getExistBatchEntity(@Param("corpid") String corpid, @Param("parentIdIn") Set<Long> parentIdIn);

    List<String> getCorpidExistBatch(@Param("list")List<String> corpidList);

    void updateStockBatch(@Param("list") List<ProductStockEntity> updateProductStockList, @Param("corpid") String corpid);

    List<ProductStockEntity> getHasBatchStockList(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    List<String> getCorpidList();

    List<String> getLatestDistinctBatch(@Param("corpid")String corpid, @Param("batchLike")String batch);

    void updateProductStockById(@Param("list")List<ProductStockEntity> productStockEntityList, @Param("corpid")String corpid);

    List<ProductStockEntity> getCostIsNullBatchKey(@Param("corpid")String corpid, @Param("list")List<Long> productIdList);
}
